﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Serialization;

namespace MC34063_Universal_Calculator
{
    public class ICValue /* : ISerializable*/
    {
        string _manufacturer;
        string _name;
        double _vref;
        double _accuracy;
        double _vsat;
        double _vsatDarlington;
        uint _maxFreq;
        int _Tmin;
        int _Tmax;
        double _maxVin;
        double _maxVQ;
        double _maxIsw;
        bool _isDefault = false;

        public ICValue()
        {
        }

        public ICValue(string manufacturer, string name, double maxVin, double maxIsw, double vref, double accuracy, double vsat, double maxVQ, double vsatDarlington, uint maxFreq, int tmin, int tmax)
        {
            _manufacturer = manufacturer;
            _name = name;
            _vref = vref;
            _accuracy = accuracy;
            _vsat = vsat;
            _vsatDarlington = vsatDarlington;
            _maxFreq = maxFreq;
            _Tmin = tmin;
            _Tmax = tmax;
            _maxVin = maxVin;
            _maxVQ = maxVQ;
            _maxIsw = maxIsw;
        }

        [XmlAttributeAttribute]
        public string Manufacturer
        {
            get
            {
                return _manufacturer;
            }
            set
            {
                _manufacturer = value;
            }
        }

        [XmlAttributeAttribute]
        public string Name
        {
            get
            {
                return _name;
            }
            set
            {
                _name = value;
            }
        }

        [XmlAttributeAttribute]
        public double MaxVin
        {
            get
            {
                return _maxVin;
            }
            set
            {
                _maxVin = value;
            }
        }

        [XmlAttributeAttribute]
        public double MaxIsw
        {
            get { return _maxIsw; }
            set { _maxIsw = value; }
        }

        [XmlAttributeAttribute]
        public double Vref
        {
            get
            {
                return _vref;
            }
            set
            {
                _vref = value;
            }
        }

        [XmlAttributeAttribute]
        public double Accuracy
        {
            get
            {
                return _accuracy;
            }
            set
            {
                _accuracy = value;
            }
        }

        [XmlAttributeAttribute]
        public double Vsat
        {
            get
            {
                return _vsat;
            }
            set
            {
                _vsat = value;
            }
        }

        [XmlAttributeAttribute]
        public double MaxVQ
        {
            get
            {
                return _maxVQ;
            }
            set
            {
                _maxVQ = value;
            }
        }

        [XmlAttributeAttribute]
        public double VsatDarlington
        {
            get
            {
                return _vsatDarlington;
            }
            set
            {
                _vsatDarlington = value;
            }
        }

        [XmlAttributeAttribute]
        public uint MaxFrequency
        {
            get
            {
                return _maxFreq;
            }
            set
            {
                _maxFreq = value;
            }
        }

        [XmlAttributeAttribute]
        public int Tmin
        {
            get
            {
                return _Tmin;
            }
            set
            {
                _Tmin = value;
            }
        }

        [XmlAttributeAttribute]
        public int Tmax
        {
            get
            {
                return _Tmax;
            }
            set
            {
                _Tmax = value;
            }
        }

        [XmlAttributeAttribute]
        public bool IsDefault
        {
            get
            {
                return _isDefault;
            }
            set
            {
                _isDefault = value;
            }
        }

        public override string ToString()
        {
            string nameLocalized;
            WPFLocalizeExtension.Extensions.LocTextExtension locTextExt = new WPFLocalizeExtension.Extensions.LocTextExtension("MC34063_Universal_Calculator:Global:Andere");
            locTextExt.ResolveLocalizedValue(out nameLocalized);

            if (_name == nameLocalized)
            {
                return _name;
            }
            else
            {
                return _manufacturer + " " + _name; /* + " Vref=" + _vref.ToString("F2") + " " + _accuracy.ToString("F1") + "% " + _Tmin + "°C - " + _Tmax + "°C";*/
            }
        }
    }
}

//(c) 2011 - Tobias Eiseler

//This program is free software: you can redistribute it and/or modify
//it under the terms of the GNU General Public License as published by
//the Free Software Foundation, either version 3 of the License, or
//(at your option) any later version.

//This program is distributed in the hope that it will be useful,
//but WITHOUT ANY WARRANTY; without even the implied warranty of
//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//GNU General Public License for more details.

//You should have received a copy of the GNU General Public License
//along with this program.  If not, see <http://www.gnu.org/licenses/>